package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.dao.OrderDao;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Order;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 32338
 * @date 2024-05-04 14:44:35
 * @description 预约管理
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderDao orderDao;

    /**
     * @description
     ***:分页查询
     **/
    public PageResult page(QueryPageBean queryPageBean) {
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());

        Page<Order> page = orderDao.page(queryPageBean.getQueryString());

        return new PageResult(page.getTotal(),page.getResult());
    }
    /**
     * @description
     ***:预约状态管理
     **/
    public void update(Order order) {
        orderDao.update(order);
    }

    /**
     * @description
     ***:根据预约id查询回显
     **/
    public Order findById(Integer id) {
        return orderDao.findById(id);
    }
}
